package com.talent.service.admin.controller;

import com.talent.common.model.TalentResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName：TestController
 * @Author: hszhou
 * @Date: 2025/2/15 14:52
 * @Description: 测试类
 */
@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {

    @RequestMapping("/one")
    @PreAuthorize("hasAuthority('menu:add')")
    public TalentResult test(){

        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        log.info("【{}】",principal);
        return TalentResult.success();
    }
    @RequestMapping("/two")
    @PreAuthorize("hasAuthority('menu:add1')")
    public TalentResult test1(){
        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        log.info("【{}】",principal);
        return TalentResult.success();
    }

}
